import { createHashRouter, Navigate } from 'react-router-dom'

import Layout from '@renderer/layout'

import Repository from '@renderer/views/Repository'
import Navigation from '@renderer/views/Navigation'
import Home from '@renderer/views/Home'
import Manage from '@renderer/views/Manage'

const routes = [
  {
    path: '',
    element: <Navigate to="/repository" />
  },
  {
    path: 'repository',
    name: '地图资源库',
    element: <Layout />,
    roles: ['ANY', 'admin', 'qianzhi123'],
    children: [
      {
        path: '',
        element: <Repository />
      }
    ]
  },
  {
    path: 'navigation',
    name: '导航',
    element: <Layout />,
    roles: ['ANY', 'admin', 'qianzhi123'],
    children: [
      {
        path: '',
        element: <Navigation />
      }
    ]
  },
  {
    path: 'home',
    name: '车辆控制',
    element: <Layout />,
    roles: ['ANY', 'admin', 'qianzhi123'],
    children: [
      {
        path: '',
        element: <Home />
      }
    ]
  },
  {
    path: 'manage',
    name: '车辆控制',
    element: <Layout />,
    roles: ['ANY', 'admin', 'qianzhi123'],
    children: [
      {
        path: '',
        element: <Manage />
      }
    ]
  }
]

export default createHashRouter(routes)
